<?php get_header(); ?>
<main role="main" class="">

    <section id="breadcrumbs" class="breadcrumbs">
        <?php $category = get_queried_object(); ?>
        <div class="container py-3">
            <div class="py-lg-5 d-flex flex-column justify-content-center align-items-center">
                <h1><a href="<?php echo get_term_link($category->term_id); ?>" rel="category"><?php echo $category->name; ?></a></h1>
                <ol>
                    <li><a class="text-decoration-none text-white" href="<?php home_url('/'); ?>">home page</a></li>
                    <li><a class="text-decoration-none text-white" href="<?php echo get_term_link($category->term_id); ?>"><?php echo $category->name; ?></a></li>
                </ol>
            </div>
        </div>
    </section>
    <div class="container mt-5">
        <div class="row">
            <div class="col-md-3 d-none d-sm-block">
                <div class="sidebar-service bg-customer py-3 px-1 px-lg-3 mb-3 wow fadeInUp">

                    <div class="section-title-page">
                        <h4 class="text-white">服务项目</h4>
                    </div>
                    <nav class="sidebar-service-nav navbar">
                        <ul id="menu-service" class="bg-white rounded-3 ps-lg-3 pe-lg-3 navbar-nav">
                            <?php
                            $args = [
                                'taxonomy' => 'product_cat',
                                'hide_empty' => true,
                                'parent' => 0,
                            ];
                            $product_cats = get_terms($args);
                            ?>
                            <?php if ($product_cats) : ?>
                                <?php foreach ($product_cats as $product_cat) : ?>
                                    <li id="menu-item-<?php echo $product_cat->term_id; ?>" class="menu-item menu-item-type-post_type menu-item-object-post current-menu-item menu-item-<?php echo $product_cat->term_id; ?>">
                                        <a href="<?php echo get_term_link($product_cat->term_id); ?>" aria-current="page"><?php echo $product_cat->name; ?></a>
                                    </li>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        </ul>
                    </nav>

                </div>

                <div class="sidebar-contact bg-light-customer py-3 px-3 mb-3 wow fadeInUp">
                    <div class="section-title-page">
                        <h4>联系我们</h4>
                    </div>
                    <ul>
                        <li><i class="fa fa-map-marker"></i> 北京海淀区学院路20号院F号楼5单元</li>
                        <li><i class="fa fa-phone"></i> 139-1018-5004</li>
                        <li><i class="fa fa-user"></i> 艾中华</li>
                        <li><i class="fa fa-envelope"></i> 4541293@qq.com</li>
                    </ul>
                </div>
            </div>
            <div class="col-md-9">
                <div class="row">
                    <?php if (have_posts()) : ?>
                        <?php while (have_posts()) : the_post(); ?>
                            <div class="col-md-4 mb-3">
                                <div class="bg-light-customer shadow-sm effect-imghover">
                                    <a href="<?php the_permalink(); ?>">
                                        <?php the_post_thumbnail('shop_thumbnail', ['class' => 'img-fluid', 'alt' => get_the_title()]); ?>
                                    </a>
                                    <div class="p-3">
                                        <h6 class="mt-1 text-center"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6>
                                        <p><?php the_excerpt(); ?></p>
                                    </div>
                                </div>
                            </div>
                        <?php endwhile; ?>
                    <?php endif; ?>
                </div>
                <!-- row -->
                <div class="row my-5">
                    <div class="col-md-12">
                        <?php // 设置分页参数
                        $args = array(
                            'format'    => '?paged=%#%', // 指定分页格式
                            'type'      => 'list', // 指定为列表类型
                            'prev_next' => false,
                            'aria_current' => 'active',
                        );
                        // 获取分页链接
                        echo $paginates = paginate_links($args);
                        ?>
                    </div>
                </div>
            </div>
        </div>
        <!-- row -->
    </div>
</main>
<?php get_footer(); ?>